<?php include 'myFunction.php'?>
<form name="productFrm" method="post" action="index.php?menu=confermadd">
<table border="1" width="100%">
	<tr>
		<th align="center" colspan="4">เพิ่มสินค้าใหม่</th>
	</tr>
	<tr>
		<td align="right" width="20%">ชนิดสินค้า</td>
		<td colspan="3" align="left" width="80%">
		<select name="type">
		<?php
			switch ($_GET['pgroup'])
			{
				case 'bed':{
					echo "<option id='optionBed' value='bed' onclick='bedProduct()'>ที่นอน</option>";
					echo "<option id='optionDoll' value='doll' onclick='dollProduct()'>ตุ๊กตา</option>";
					echo "<option id='optionEtc' value='etc' onclick='etcProduct()'>อื่นๆ</option>";
				}break;
				case 'doll':{
					echo "<option id='optionDoll' value='doll' onclick='dollProduct()'>ตุ๊กตา</option>";
					echo "<option id='optionEtc' value='etc' onclick='etcProduct()'>อื่นๆ</option>";
					echo "<option id='optionBed' value='bed' onclick='bedProduct()'>ที่นอน</option>";
				}break;
				case 'etc':{
					echo "<option id='optionEtc' value='etc' onclick='etcProduct()'>อื่นๆ</option>";
					echo "<option id='optionBed' value='bed' onclick='bedProduct()'>ที่นอน</option>";
					echo "<option id='optionDoll' value='doll' onclick='dollProduct()'>ตุ๊กตา</option>";
				}break;
				default:{
					echo "<option id='blank' value=''>เลือกชนิดสินค้า</option>";
					echo "<option id='optionBed' value='bed' onclick='bedProduct()'>ที่นอน</option>";
					echo "<option id='optionDoll' value='doll' onclick='dollProduct()'>ตุ๊กตา</option>";
					echo "<option id='optionEtc' value='etc' onclick='etcProduct()'>อื่นๆ</option>";
				}
			}
		
		?>
		</select></td>
	</tr>
	<tr>
		<td align="right" width="20%">ราคาทุน:</td>
		<td align="left" width="15%"><input value="<?php echo $_GET["cost"];?>" onchange="findPrice(this.value)" type="text" id="cost" name="cost" size="10" maxlength="10"></td>
		<td align="left" width="25%">ราคาขาย:<input value="<?php echo $_GET["price"];?>" type="text" id="price" name="price" size="10" maxlength="10"></td>
		<td align="left" width="40%">หน่วย:<input type="text" id="unit" name="unit" size="20" maxlength="20" value="<?php echo findUnit($_GET['pgroup']); ?>"></td>
	</tr>
	<?php
	if (isset($_GET['pgroup']))
	{
		switch($_GET['pgroup']){
			case "bed": include("bedProduct.php"); break;
			case "doll": include("dollProduct.php"); break;
			//case "etc": include("etcProduct.php"); break;
			//default : include("home.php");
		}
	}
	?>
	<tr>
		<td align="right" width="20%">ชื่อสินค้า</td>
		<td colspan="3" align="left" width="80%">
			<input type="text" id="pname" name="pname" size="50" maxlength="50" onfocus="findProductName('<?php echo substr($_GET['pgroup'], 0, 1)?>')"></td>
	</tr>
	<tr>
		<td colspan="4" align="center">
			<input type="submit" value="บันทึก">		
		</td>
	</tr>
</table>
</form>
